package cn.waka.sys.admin.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.waka.sys.admin.object.Result;

@RestController
public class LogoutController extends BaseController {
    @RequestMapping(path = "/logout", produces = "application/json;  charset=UTF-8")
    public Result index(HttpServletRequest req, HttpServletResponse res) {
        HttpSession ses = req.getSession();
        ses.removeAttribute("uid");
        ses.removeAttribute("uname");
        ses.invalidate();
        Result rs = ok();
        rs.setCode(1);
        rs.setUrl("login");
        rs.setMsg("退出成功!");
        return rs;
    }
}
